<?php
include("include/conn.php");
require('include/Smarty/libs/Smarty.class.php');

$rojmelDetailArray = array();
$opening  = array();
$total    = array();
$fromDate = isset($_POST['fromDateYear']) ? $_POST['fromDateYear']."-".$_POST['fromDateMonth']."-".$_POST['fromDateDay'] : date("Y-m-d");
$toDate   = isset($_POST['toDateYear']) ? $_POST['toDateYear']."-".$_POST['toDateMonth']."-".$_POST['toDateDay'] : date("Y-m-d");

$opening['particular'] = "Opening";
$opening['crFine']     = 0;
$opening['drFine']     = 0;
$opening['crAmount']   = 0;
$opening['cramount']   = 0;
$opening['drAmount']   = 0;
$opening['dramount']   = 0;
$total['drFine']       = 0;
$total['drfine']       = 0;
$total['crFine']       = 0;
$total['crfine']       = 0;
$total['crAmount']     = 0;
$total['cramount']     = 0;
$total['drAmount']     = 0;
$total['dramount']     = 0;
$finalOpening['fine']  = 0;
$finalOpening['amount']= 0;
$finalFineOpeningDr    = 0;
$finalFineOpeningCr    = 0;
$finalAmountOpeningCr  = 0;
$finalAmountOpeningDr  = 0;
$currentRowDisplayAt   = 0;
$currentRowDisplayAt   = 0;
$netAmount             = 0;
$netFine               = 0;
$netamount             = 0;
$netfine               = 0;

// This for get data from rojmel : Start
$selectRojmel = "SELECT rojmelId,partyName, DATE_FORMAT(rojmelDate,'%Y-%m-%d') AS rojmelDate, particulars, fine, amount, CrDr 
                   FROM rojmel
                  WHERE DATE_FORMAT(rojmelDate,'%Y-%m-%d') <= '".$toDate."'
               ORDER BY rojmelDate";
$selectRojmelRes = mysql_query($selectRojmel);
$rojmelCount = 0;
$currentRowDisplayAt = 0;
while($rojmelRow = mysql_fetch_assoc($selectRojmelRes))
{
  if($rojmelRow['rojmelDate'] >= $fromDate)
  { 
    if(isset($rojmelDetailArray[$currentRowDisplayAt]['rojmelDate'])
           && ($rojmelDetailArray[$currentRowDisplayAt]['rojmelDate']   == $rojmelRow['rojmelDate'] 
           || $rojmelDetailArray[$currentRowDisplayAt]['rojmelDateCr'] == $rojmelRow['rojmelDate'] ))// && date prev and current both same
    {
      $rojmelDetailArray[$currentRowDisplayAt]['displayGhat'] = 0;
    }
    else
    {
      $currentDebitGhat = 0;	
      
      $myDrGroupIdStartRow = 	$rojmelCount;
  		$rojmelDrCount = 0;
  		$rojmelCrCount = 0;
    }
  	if($rojmelRow['CrDr'] == "Dr")
      $currentRowDisplayAt = $myDrGroupIdStartRow + $rojmelDrCount;
    else
      $currentRowDisplayAt = $myDrGroupIdStartRow + $rojmelCrCount;    
    
    
    if($rojmelRow['CrDr'] == 'Dr')
    {
  		if($rojmelDrCount >= $rojmelCrCount)
      {
        //For Credit Blank Vars :Start
  		  $rojmelDetailArray[$currentRowDisplayAt]['rojmelIdCr']      = 0;
  		  $rojmelDetailArray[$currentRowDisplayAt]['partyNameCr']     = "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['rojmelDateCr']    = "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['particularCr']    = "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['fineCr']          = "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['amountCr']        = "";
  		  //For Credit Blank Vars :End
  		}      
      $rojmelDetailArray[$currentRowDisplayAt]['rojmelId']   = $rojmelRow['rojmelId'];
      $rojmelDetailArray[$currentRowDisplayAt]['partyName']  = $rojmelRow['partyName'];
      $rojmelDetailArray[$currentRowDisplayAt]['rojmelDate'] = $rojmelRow['rojmelDate'];
      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $rojmelRow['particulars'];
      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $rojmelRow['fine'];
      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $rojmelRow['amount'];
    }
    else
    {
    	if($rojmelCrCount >= $rojmelDrCount)
      {
  		  $rojmelDetailArray[$currentRowDisplayAt]['rojmelId']     =  0;
  		  $rojmelDetailArray[$currentRowDisplayAt]['partyName']    =  "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['rojmelDate']   =  "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['particular']   =  "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['fine']         =  "";
  		  $rojmelDetailArray[$currentRowDisplayAt]['amount']       =  "";
  		}      
      $rojmelDetailArray[$currentRowDisplayAt]['rojmelIdCr']   = $rojmelRow['rojmelId'];
      $rojmelDetailArray[$currentRowDisplayAt]['partyNameCr']  = $rojmelRow['partyName'];
      $rojmelDetailArray[$currentRowDisplayAt]['rojmelDateCr'] = $rojmelRow['rojmelDate'];
      $rojmelDetailArray[$currentRowDisplayAt]['particularCr'] = $rojmelRow['particulars'];
      $rojmelDetailArray[$currentRowDisplayAt]['fineCr']       = $rojmelRow['fine'];;
      $rojmelDetailArray[$currentRowDisplayAt]['amountCr']     = $rojmelRow['amount'];
    }
    if($rojmelRow['CrDr'] == "Dr")
    {
      $total['drFine']   += $rojmelRow['fine'];  
      $total['drAmount'] += $rojmelRow['amount'];
  		$rojmelDrCount++;
  		if($rojmelDrCount > $rojmelCrCount)
  		  $rojmelCount++;
  	}
    else
    {
      $total['crFine']   += $rojmelRow['fine'];
      $total['crAmount'] += $rojmelRow['amount'];
  	  $rojmelCrCount++;
  		if($rojmelCrCount > $rojmelDrCount)
  		  $rojmelCount++;
  		 
  	}
    $finalOpening['fine'] = $total['drFine'] - $total['crFine'];     
  	$finalOpening['amount'] = $total['drAmount'] - $total['crAmount'];
  	if($finalOpening['fine'] > 0)
  	{
  	  $finalFineOpeningDr = $finalOpening['fine'];
  	  $finalFineOpeningCr = "";
    }          
    else
    {
      $finalFineOpeningCr = $finalOpening['fine'];
    $finalFineOpeningDr = "";    
    }                
    if($finalOpening['amount'] > 0)
  	{
  	  $finalAmountOpeningDr = $finalOpening['amount'];
  	  $finalAmountOpeningCr = "";
    }          
    else
    {
      $finalAmountOpeningCr = $finalOpening['amount'];
     $finalAmountOpeningDr = "";                     
    }
  }
  else
  {
    if($rojmelRow['CrDr'] == 'Cr')
    {
      $opening['crFine']   += $rojmelRow['fine'];
      $opening['crAmount'] += $rojmelRow['amount'];
    }
    else
    {
      $opening['drFine']   += $rojmelRow['fine'];
      $opening['drAmount'] += $rojmelRow['amount'];
    }
  }
}
// This for get data from rojmel : end

// This for get data from veepari book : start
//$selectVeepariBook = "SELECT vepaaribillmaster.vepaariBookMasterId,DATE_FORMAT(vepaaribillmaster.vepaariBookDate,'%Y-%m-%d') AS vepaariBookDate,vepaaribilldetail.particulars,
//                             vepaaribilldetail.fine,vepaaribilldetail.amount,vepaaribilldetail.CrDr,party.partyName
//                        FROM vepaaribillmaster
//                        JOIN vepaaribilldetail  ON vepaaribilldetail.vepaariBookMasterId = vepaaribillmaster.vepaariBookMasterId
//                        JOIN party ON party.partyId = vepaaribillmaster.partyId
//                       WHERE DATE_FORMAT(vepaariBookDate,'%Y-%m-%d') <= '".$toDate."'
//                         AND inRojmel = 1
//                    ORDER BY vepaariBookDate";
//$selectVeepariBookRes = mysql_query($selectVeepariBook);
//while($veepariBookRow = mysql_fetch_assoc($selectVeepariBookRes))
//{
//  if($veepariBookRow['vepaariBookDate'] >= $fromDate)
//  {
//    if(($veepariBookRow['CrDr']) == 'Cr')
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $veepariBookRow['vepaariBookDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $veepariBookRow['particulars']."(".$veepariBookRow['partyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $veepariBookRow['fine'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $veepariBookRow['amount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "deleteVepaariBook.php?vepaariBookMasterId=".$veepariBookRow['vepaariBookMasterId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?vepaariBookMasterId=".$veepariBookRow['vepaariBookMasterId'];
//      $currentRowDisplayAt++;
//    }
//    else
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $veepariBookRow['vepaariBookDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $veepariBookRow['particulars']."(".$veepariBookRow['partyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $veepariBookRow['fine'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $veepariBookRow['amount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "deleteVepaariBook.php?vepaariBookMasterId=".$veepariBookRow['vepaariBookMasterId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?vepaariBookMasterId=".$veepariBookRow['vepaariBookMasterId'];
//      $currentRowDisplayAt++;
//    }
//  }
//  else
//  {
//    if($veepariBookRow['CrDr'] == 'Cr')
//    {
//      $opening['crFine']   += $veepariBookRow['fine'];
//      $opening['crAmount'] += $veepariBookRow['amount'];
//    }
//    else
//    {
//      $opening['drFine']   += $veepariBookRow['fine'];
//      $opening['drAmount'] += $veepariBookRow['amount'];
//    }
//  }
//  
//  if($veepariBookRow['CrDr'] == 'Cr')
//  {
//    $total['crFine']   += $veepariBookRow['fine'];
//    $total['crAmount'] += $veepariBookRow['amount'];
//  }
//  else
//  {
//    $total['drFine']   += $veepariBookRow['fine'];
//    $total['drAmount'] += $veepariBookRow['amount'];
//  }
//}
// This for get data from veepari book : End

//// This for get data from bhatthi : Start 
//$bhatthiBookDetail = "SELECT bhatthibook.bhatthiBookId, DATE_FORMAT(bhatthibook.bhatthiDate,'%Y-%m-%d') As bhatthiDate, bhatthibookdetail.bhatthiBookId,
//                             bhatthibookdetail.particulars, bhatthibookdetail.fine, bhatthibookdetail.amount, bhatthibookdetail.CrDr, bhatthiparty.bhatthipartyName
//                        FROM bhatthibook
//                        JOIN bhatthibookdetail ON bhatthibookdetail.bhatthiBookId = bhatthibook.bhatthiBookId
//                        JOIN bhatthiparty ON bhatthiparty.bhatthipartyId = bhatthibook.bhatthiPartyId
//                       WHERE bhatthibook.bhatthiDate <= '".$toDate."'
//                         AND bhatthibookdetail.inRojmel = 1
//                    ORDER BY bhatthibook.bhatthiDate";
//$bhatthiBookDetailRes = mysql_query($bhatthiBookDetail);
//while($bhatthiRow = mysql_fetch_assoc($bhatthiBookDetailRes))
//{
//  if($bhatthiRow['bhatthiDate'] >= $fromDate)
//  {
//    if($bhatthiRow['CrDr'] == 'Cr')
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $bhatthiRow['bhatthiDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $bhatthiRow['particulars']."(".$bhatthiRow['bhatthipartyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $bhatthiRow['fine'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $bhatthiRow['amount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "deleteBhatthiBook.php?bhatthiId=".$bhatthiRow['bhatthiBookId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?bhatthiId=".$bhatthiRow['bhatthiBookId'];
//      $currentRowDisplayAt++;
//    }
//    else
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $bhatthiRow['bhatthiDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $bhatthiRow['particulars']."(".$bhatthiRow['bhatthipartyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $bhatthiRow['fine'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $bhatthiRow['amount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "deleteBhatthiBook.php?bhatthiId=".$bhatthiRow['bhatthiBookId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?bhatthiId=".$bhatthiRow['bhatthiBookId'];
//      $currentRowDisplayAt++;
//    }
//  }
//  else
//  {
//    if($bhatthiRow['CrDr'] == 'Cr')
//    {
//      $opening['crFine']   += $bhatthiRow['fine'];
//      $opening['crAmount'] += $bhatthiRow['amount'];
//    }
//    else
//    {
//      $opening['drFine']   += $bhatthiRow['fine'];
//      $opening['drAmount'] += $bhatthiRow['amount'];
//    }
//  }
//  
//  if($bhatthiRow['CrDr'] == 'Cr')
//  {
//    $total['crFine']   += $bhatthiRow['fine'];
//    $total['crAmount'] += $bhatthiRow['amount'];
//  }
//  else
//  {
//    $total['drFine']   += $bhatthiRow['fine'];
//    $total['drAmount'] += $bhatthiRow['amount'];
//  }
//}
//// This for get data from bhatthi : End

// This for get data from kaariger : Start
//$selectKaarigarDetail = "SELECT kaarigardetail.kaarigardetailId, kaarigardetail.kaarigarId, DATE_FORMAT(kaarigardetail.kaarigarDate,'%Y-%m-%d') AS kaarigarDate, 
//                                kaarigardetail.particulars, kaarigardetail.crAmount, kaarigardetail.drAmount, kaarigar.kaarigarName
//                           FROM kaarigardetail
//                           JOIN kaarigar ON kaarigar.kaarigarId = kaarigardetail.kaarigarId
//                          WHERE DATE_FORMAT(kaarigarDate,'%Y-%m-%d') <= '".$toDate."'
//                            AND kaarigardetail.inRojmel = 1
//                       ORDER BY kaarigarDate";
//$selectKaarigarDetailRes = mysql_query($selectKaarigarDetail);
//while($kaarigarDetailRow = mysql_fetch_assoc($selectKaarigarDetailRes))
//{
//  if($kaarigarDetailRow['kaarigarDate'] >= $fromDate)
//  {
//    if($kaarigarDetailRow['crAmount'] > 0)
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $kaarigarDetailRow['kaarigarDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $kaarigarDetailRow['particulars']."(".$kaarigarDetailRow['kaarigarName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = "";
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $kaarigarDetailRow['crAmount'];
//     $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "kaarigarDetailDelete.php?kaarigardetailId=".$kaarigarDetailRow['kaarigardetailId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?kaarigardetailId=".$kaarigarDetailRow['kaarigardetailId'];
//      $currentRowDisplayAt++;
//    }
//    
//    if($kaarigarDetailRow['drAmount'] > 0)
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $kaarigarDetailRow['kaarigarDate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $kaarigarDetailRow['particulars']."(".$kaarigarDetailRow['kaarigarName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = "";
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $kaarigarDetailRow['drAmount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "kaarigarDetailDelete.php?kaarigardetailId=".$kaarigarDetailRow['kaarigardetailId'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?kaarigardetailId=".$kaarigarDetailRow['kaarigardetailId'];
//      $currentRowDisplayAt++;
//    }
//  }
//  else
//  {
//    $opening['drAmount'] += $kaarigarDetailRow['drAmount'];
//    $opening['crAmount'] += $kaarigarDetailRow['crAmount'];
//  }
//    
//  $total['drAmount'] += $kaarigarDetailRow['drAmount'];
//  $total['crAmount'] += $kaarigarDetailRow['crAmount'];
//}
// This for get data from kaariger : End

////This is for Bullion data from Bullion:Start
// $selectbullionDetail = "SELECT bulliondetail.bulliondetailid, bulliondetail.bullionmasterid, bulliondetail.particulars,bulliondetail.kg,bulliondetail.bhav,DATE_FORMAT(bullionmaster.bulliondate,'%Y-%m-%d') AS bulliondate,bulliondetail.cramount,bulliondetail.crfine, bulliondetail.dramount, bullionparty.bullionPartyName
//                               FROM bulliondetail
//                               JOIN bullionmaster ON bullionmaster.bullionmasterid = bulliondetail.bullionmasterid
//                               JOIN bullionparty ON bullionparty.partyId = bullionmaster.partyId
//                              WHERE DATE_FORMAT(bulliondate,'%Y-%m-%d') <= '".$toDate."'
//                                AND bulliondetail.inRojmel = 1
//                           ORDER BY bulliondate";
//$selectbullionDetailRes = mysql_query($selectbullionDetail);
//while($bullionDetailRow = mysql_fetch_assoc($selectbullionDetailRes))
//{
//  if($bullionDetailRow['bulliondate'] >= $fromDate)
//  {
//    if($bullionDetailRow['cramount'] > 0 || $bullionDetailRow['crfine'] > 0  || $bullionDetailRow['particulars'] > 0)
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $bullionDetailRow['bulliondate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $bullionDetailRow['particulars']."(".$bullionDetailRow['bullionPartyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $bullionDetailRow['crfine'];
//      $total['crFine']                   += $bullionDetailRow['crfine'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $bullionDetailRow['cramount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "bullionDelete.php?bulliondetailid=".$bullionDetailRow['bulliondetailid'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?bulliondetailid=".$bullionDetailRow['bulliondetailid'];
//      $currentRowDisplayAt++;
//    }
//
//    if($bullionDetailRow['dramount'] > 0 || $bullionDetailRow['kg'] > 0 || $bullionDetailRow['particulars'] > 0)
//    {
//      $rojmelDetailArray[$currentRowDisplayAt]['date']       = $bullionDetailRow['bulliondate'];
//      $rojmelDetailArray[$currentRowDisplayAt]['particular'] = $bullionDetailRow['particulars']."(".$bullionDetailRow['bullionPartyName'].")";
//      $rojmelDetailArray[$currentRowDisplayAt]['fine']       = $bullionDetailRow['kg'];
//      $total['drFine']                   += $bullionDetailRow['kg'];
//      $rojmelDetailArray[$currentRowDisplayAt]['amount']     = $bullionDetailRow['dramount'];
//      $rojmelDetailArray[$currentRowDisplayAt]['deleteLink'] = "bullionDelete.php?bulliondetailid=".$bullionDetailRow['bulliondetailid'];
//      $rojmelDetailArray[$currentRowDisplayAt]['editLink']   = "rojmelEntry.php?bulliondetailid=".$bullionDetailRow['bulliondetailid'];
//      $currentRowDisplayAt++;
//    }
//  }
//  else
//  {
//    $opening['drAmount'] += $bullionDetailRow['dramount'];
//    $opening['crAmount'] += $bullionDetailRow['cramount'];
//  }
//
//  $total['drAmount'] += $bullionDetailRow['dramount'];
//  $total['crAmount'] += $bullionDetailRow['cramount'];
//}
// This for get data from kaariger : End


// This for sort credit array : Start
//if(count($rojmelDetailArray) > 0)
//{
//  foreach ($rojmelDetailArray as $key => $value) 
//  {
//    $tempArr[$key] = $value['date'];
//  }
//  array_multisort($rojmelDetailArray,SORT_ASC,SORT_STRING,$tempArr);
//}
//// This for sort credit array : End
//
//// This for sort debit array : Start
//if(count($rojmelDetailArray) > 0)
//{
//  foreach ($rojmelDetailArray as $key => $value) 
//  {
//    $tempArr1[$key] = $value['date'];
//  }
//  array_multisort($rojmelDetailArray,SORT_ASC,SORT_STRING,$tempArr1);
//}
//// This for sort debit array : End

$netAmount = ($total['drAmount']  - $total['crAmount']);
$netFine   = ($total['drFine'] - $total['crFine']);


$netamount = ($total['dramount'] - $total['cramount']);
$netfine   = ($total['drfine'] - $total['crfine'] );


$smarty = new Smarty;
require("bottom.php");
$smarty->assign("l_credit",$l_credit);
$smarty->assign("l_debit",$l_debit);
$smarty->assign("l_date",$l_date);
$smarty->assign("l_particulars",$l_particulars);
$smarty->assign("l_fine",$l_fine);
$smarty->assign("l_amount",$l_amount);
$smarty->assign("l_from",$l_from);
$smarty->assign("l_to",$l_to);
$smarty->assign("l_find",$l_find);
$smarty->assign("l_total",$l_total);
$smarty->assign("l_netAmount",$l_netAmount);
$smarty->assign("l_netFine",$l_netFine);
$smarty->assign("l_delete",$l_delete);
$smarty->assign("l_edit",$l_edit);

$smarty->assign("fromDate",$fromDate);
$smarty->assign("toDate",$toDate);
$smarty->assign("rojmelDetailArray",$rojmelDetailArray);
$smarty->assign("opening",$opening);
$smarty->assign("total",$total);
$smarty->assign("netAmount",$netAmount);
$smarty->assign("netFine",$netFine);
$smarty->assign("netamount",$netamount);
$smarty->assign("netfine",$netfine);
$smarty->assign("finalFineOpeningDr",$finalFineOpeningDr);
$smarty->assign("finalFineOpeningCr",$finalFineOpeningCr);
$smarty->assign("finalAmountOpeningDr",$finalAmountOpeningDr);
$smarty->assign("finalAmountOpeningCr",$finalAmountOpeningCr);
$smarty->display("rojmel.tpl");
?>